<?php

namespace App\Transformers;

use App\Models\Brand;
use League\Fractal\TransformerAbstract;

class BrandTransformer extends TransformerAbstract
{
    public function transform(Brand $brands)
    {
        $grouped = $brands::query()->get(['id', 'name', 'tag', 'count'])
            ->sortBy('tag')->groupBy('tag');



        return $grouped->toArray();
    }
}